﻿using Microsoft.Extensions.DependencyInjection;
using System.Reflection;

namespace D.UtilAutoMapper
{
    /// <summary>
    /// 实体互转映射
    /// </summary>
    public static class AutoMapperUtil
    {

        /// <summary>
        /// 自动映射
        /// </summary>
        /// <param name="services"></param>
        /// <param name="t">Dictionary<t1, t2>，把t1的数据转成t2</param>
        public static void AddAutoMapper(this IServiceCollection services, Dictionary<Type, Type> t)
        {
            if (t.Count > 0)
            {
                new AutoMapperConfiguration(t);
            }
           
            //var serviceAssembly = Assembly.Load("Admin.Core.Service");
            //services.AddAutoMapper(serviceAssembly);
        }
    }
}
